
import org.apache.spark.ml.linalg.{SQLDataTypes, Vectors}
import org.apache.spark.sql.types.{IntegerType, StructField, StructType}
import org.apache.spark.sql.{Row, SparkSession}
import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by Administrator on 2017/12/20.
  */
object ${main_class} {

  def main(args: Array[String]) {
    val conf = new SparkConf().setAppName(s"${app_name}").setMaster("local[*]")
    val sc = new SparkContext(conf)
    val sparkSession = SparkSession.builder().getOrCreate()
    import sparkSession.implicits._
    val rows = sc.parallelize(Array((1,Vectors.dense(1)), (2,Vectors.dense(1))))
    rows.toDF("a","b").show()

   val schema =  StructType(Seq(
      StructField("a",IntegerType,true),
      StructField("vec",SQLDataTypes.VectorType,true)
    ))
    val xx = sparkSession.createDataFrame(rows.map(x=>{Row(x._1,x._2)}),schema)
    xx.show()

  }



}
